package com.example.ucs_alg_node_manager.controller;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.example.ucs_alg_node_manager.domain.Task;
import com.example.ucs_alg_node_manager.service.TaskService;
import com.example.ucs_alg_node_manager.vo.ReturnVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/task")
@CrossOrigin
@Api("任务信息管理")
public class TaskController {

    @Resource
    private TaskService taskService;

    @ApiOperation("查询节点任务列表")
    @GetMapping("/query")
    public ReturnVO query(@RequestParam("nodeId")Integer nodeId){
        return ReturnVO.ok(taskService.list(Wrappers.<Task>lambdaQuery().eq(Task::getNodeId, nodeId).orderByDesc(Task::getTs))).message("查询成功");
    }
}
